#include "thread_pool_1.h"

#include <iostream>

ThreadPool_1::ThreadPool_1()
    : ThreadPool(),
      thread_id_(static_cast<size_t>(
          std::hash<std::thread::id>()(std::this_thread::get_id()))) {}

ThreadPool_1::ThreadPool_1(size_t thread_n, size_t hold_n, size_t max_n)
    : ThreadPool(thread_n, hold_n, max_n),
      thread_id_(static_cast<size_t>(
          std::hash<std::thread::id>()(std::this_thread::get_id()))) {}

void ThreadPool_1::OnStart() {
  std::lock_guard<std::mutex> lock(io_mutex);
  std::cout << "start -- " << thread_id_ << std::endl;
}

void ThreadPool_1::OnStop() {
  std::lock_guard<std::mutex> lock(io_mutex);
  std::cout << "stop -- " << thread_id_ << std::endl;
}

void ThreadPool_1::OnThreadStart() {
  std::lock_guard<std::mutex> lock(io_mutex);
  std::cout << "thread start -- " << thread_id_ << std::endl;
}

void ThreadPool_1::OnThreadEnd() {
  std::lock_guard<std::mutex> lock(io_mutex);
  std::cout << "thread end -- " << thread_id_ << std::endl;
}